﻿/**
 * Proyecto: Cognitum
 * Global IT Services 2008
 * @author Esanantonio
 */
Cognitum.Polizas.ComisionesDefault.Entity = function(){
    if (LOG.isDebugEnabled()) {
        LOG.debug('[ComisionesDefault.Entity.ctor] <-');
    }
    Cognitum.Polizas.ComisionesDefault.Entity.superclass.constructor.call(this, false, true);
}

Ext.extend(Cognitum.Polizas.ComisionesDefault.Entity, Karma.Core.Entity, {
    id: 'ComisionesDefault.Entity',
    name: 'ComisionDefault',
    editorXType: 'com.def.editor',
	editorW: 550,
	editorH: 350,
    columns: [{
        Name: 'Id',
        Property: 'Id',
        Mostrar: false
    }, {
        Name: 'Director',
        Property: 'DirectorAsociado.Nombre'
    }, {
        Name: 'Porcentaje',
        Property: 'Porcentaje'
    }, {
        Name: 'Ramo',
        Property: 'Ramo.Nombre'
    }, {
        Name: 'Cliente',
        Property: 'Cliente.RazonSocial'
    }],
    aggregatelist: {
        getTBarControls: function(){
            return [{
                xtype: 'button',
                text: 'Agregar...',
                handler: this.newRecord,
                scope: this,
                hidden: !(this.canNew && this.security.New)
            }, {
                xtype: 'button',
                text: 'Eliminar',
                handler: function(){
                    var selected = this.grid.getSelectionModel().getSelected();
                    this.deleteRecord(selected.data.Id);
                },
                scope: this,
                hidden: !(this.canDelete && this.security.Delete)
            }];
        }
    }
});

Cognitum.ComisionesDefaultAsociados = Cognitum.Polizas.ComisionesDefault.Entity;
